<h1>User list</h1>
<p>
<a href="<?=Request::$controller?>add/" class="large bold">Add new user</a>
</p>
<? if (count($users)): ?>
<table class="w100 TableWithPadding TableWithBorder" id="userList">
	<thead>
		<tr>
			<th class="w30">
				Name / Login
			</th>
			<th class="w20" filter="false">
				Actions
			</th>
			<th class="w20" filter="false">
				Email
			</th>
			<th class="w20" filter-type='ddl'>
				Role
			</th>
			<th class="w10" filter="false">
				Remove
			</th>
		</tr>
	</thead>
	<tbody>
		<? foreach ($users as $user): ?>
			<tr>
				<td>
					<?=Html::chars($user['fullName'])?><br />
					<span class="small"><?=Html::chars($user['name'])?></span>
				</td>
				<td>
					<?=Html::anchor(Request::$controller.'edit/' . $user['id'] . '/', 'Edit user information')?><br />
					<span class="small"><?=Html::anchor(Request::$controller.'password/' . $user['id'] . '/', 'change password')?></span>
				</td>
				<td><?=Html::anchor('mailto:' . $user['email'], Html::chars($user['email']))?></td>
				<td><?=Html::chars(ucfirst(strtolower(preg_replace('|([A-Z])|', ' \1', $user['role']))))?></td>
				<td>
					<? if($identity['id'] != $user['id']): ?>
					<?=Html::anchor(Request::$controller.'remove/' . $user['id'] . '/', '<img src="/images/icons/remove-user.png" />', array('onclick' => 'javascript:return confirm("Are you sure?")'))?>
					<? endif; ?>
				</td>
			</tr>
		<? endforeach; ?>
	</tbody>
</table>
<script type="text/javascript">
	$(document).ready(function() {
		$('#userList').tableFilter({ selectOptionLabel : 'Show all' });
	});
</script>
<p>
<a href="<?=Request::$controller?>add/" class="large bold">Add new user</a>
</p>
<? endif; ?>